/*
                  FoodInfo Class Definition
*/

#ifndef FOODINFO_H
#define FOODINFO_H

#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include <vector>
#include <string>
#include <fstream>
#include <iostream>
#include <boost/lexical_cast.hpp>

#include "StringUtil.h"
#include "Functions.h"

using namespace std;
using boost::lexical_cast;
using boost::bad_lexical_cast;

struct FoodType
{
    FoodType(const string& strNewName, const int& iNewValue, const int& iNewChance)
    {
        iValue = iNewValue;
        strName = strNewName;
        iChance = iNewChance;

        string strFilepath = "data//sprites//food//" + strName + ".png";

        Sprite = OptimiseAlphaSurface(IMG_Load(strFilepath.c_str()));
    }

    ~FoodType()
    {
        SDL_FreeSurface(Sprite);
    }

    int iValue;
    int iChance;
    SDL_Surface *Sprite;
    string strName;
};

class FoodInfo
{
    public:
        ~FoodInfo();

        static void LoadFoodData(const string& strFilepath);

        static void FreeTypes();

        static int getNumTypes();

        static SDL_Surface* getTypeSprite(const int& iType);

        static int getTypeScore(const int& iType);

    private:
        FoodInfo();

        static vector<FoodType*> Types;
};

#endif
